<HTML><HEAD><TITLE>FileSysDirectory</TITLE></HEAD>
<BODY>
<!#CLASSDEF
FileSysDirectory NamingContext
#ENDCLASSDEF>
<H1>FileSysDirectory</H1>

<P>Wrapper for a file system directory: a persistance repository based on the
file system.  
<P>This class allows you to treat a file system directory like a dictionary.
All files in the directory are assumed to be pickled python objects.  
<P>Public Variables: 
<DL> <DT> <I>path</I> 
<DD> 
<P>The fully qualified path to the directory.  <P>
<DT> <I>fullKey</I> 
<DD> 
<P>The full object key (basically the relative path to the object encoded as a
unix filename).  A string.  <P>

</DL>

<H2>Base Classes</H2>
<UL>
<LI>NamingContext
</UL>
<H2>Methods</H2>
<UL>
<LI><A HREF="#__delitem__(self,_key)">__delitem__(self, key)</A>
<LI><A HREF="#__getitem__(self,_key)">__getitem__(self, key)</A>
<LI><A HREF="#__init__(self,_path,_fullKey)">__init__(self, path, fullKey)</A>
<LI><A HREF="#__makeKey(self,_key)">__makeKey(self, key)</A>
<LI><A HREF="#__setitem__(self,_key,_val)">__setitem__(self, key, val)</A>
<LI><A HREF="#getRemote(self,_key,_factory)">getRemote(self, key, factory)</A>
<LI><A HREF="#has_key(self,_key)">has_key(self, key)</A>
<LI><A HREF="#items(self)">items(self)</A>
<LI><A HREF="#keys(self)">keys(self)</A>
<LI><A HREF="#values(self)">values(self)</A>
</UL>
<A NAME="__delitem__">
<A NAME="__delitem__(self,_key)">
<H3>__delitem__(self, key)</H3>
<PRE>
   def __delitem__(self, key):
</PRE>

<P>Attempts to delete the file or sub-directory indicated by <I>key</I>, which
must be a string.  
<P>Raises an <A HREF="ObjectInUseError.html"> ObjectInUseError</A> if the object
is currently being used in a remote method invocation.  Raises a <B>KeyError</B>
if there is no such file.  
<P>Subdirectory removal is not implemented yet.  
<A NAME="__getitem__">
<A NAME="__getitem__(self,_key)">
<H3>__getitem__(self, key)</H3>
<PRE>
   def __getitem__(self, key):
</PRE>

<P>Gets an item from the directory.  If there is a sub-directory named
<I>key</I>, a <B>FileSysDirectory</B> object will be returned for it.  If there
is a file named <I>key</I> in the directory, an attempt will be made to load a
single pickled instance from the file.  
<P>When called remotely, this returns a <U>copy</U> of the object.  Clients
should use the <A HREF="#getRemote"> getRemote()</A> method to obtain a remote
object.  
<A NAME="__init__">
<A NAME="__init__(self,_path,_fullKey)">
<H3>__init__(self, path, fullKey)</H3>
<PRE>
   def __init__(self, path, fullKey):
</PRE>

<A NAME="__makeKey">
<A NAME="__makeKey(self,_key)">
<H3>__makeKey(self, key)</H3>
<PRE>
   def __makeKey(self, key):
</PRE>

<P>Private method to create a full key from the partial key of a child.  
<A NAME="__setitem__">
<A NAME="__setitem__(self,_key,_val)">
<H3>__setitem__(self, key, val)</H3>
<PRE>
   def __setitem__(self, key, val):
</PRE>

<P>If <I>val</I> is a <B>FileSysDirectory</B> or <B>None</B>, tries to create a
directory for it.  If it is any other kind of object, tries to pickle it into a
file named after the key.  
<P> <I>key</I> must be a string.  
<P>This method will raise an <A HREF="ObjectInUseError.html">
ObjectInUseError</A> if the object can not be overwritten because it is
currently in use.  
<A NAME="getRemote">
<A NAME="getRemote(self,_key,_factory)">
<H3>getRemote(self, key, factory)</H3>
<PRE>
   def getRemote(self, key, factory = DynamicRemoteObjectFactory()):
</PRE>

<P>Returns a remote object that can be used to reference an object in the
storage system.  If <I>key</I> does not correspond to a file in the directory,
raises a <B>KeyError</B>.  
<P>A <I>factory</I> instance may be provided to create something other than a
DynamicRemoteObject.  
<A NAME="has_key">
<A NAME="has_key(self,_key)">
<H3>has_key(self, key)</H3>
<PRE>
   def has_key(self, key):
</PRE>

<A NAME="items">
<A NAME="items(self)">
<H3>items(self)</H3>
<PRE>
   def items(self):
</PRE>

<A NAME="keys">
<A NAME="keys(self)">
<H3>keys(self)</H3>
<PRE>
   def keys(self):
</PRE>

<A NAME="values">
<A NAME="values(self)">
<H3>values(self)</H3>
<PRE>
   def values(self):
</PRE>

</BODY></HTML>
